import 'package:flutter/material.dart';
import 'package:flutter_base_plugin/flutter_base_plugin.dart';
import 'package:flutter_base_plugin_example/config/k_color.dart';
import 'package:flutter_base_plugin_example/page/details/goods/vm/goods_details_view_model.dart';

import '../../../models/goods_details_model.dart';

/// @author:  JoeKai
/// @date 2022/6/27 16:41
/// @explain：

// ignore: camel_case_types
class GoodsDetailsInfo extends BaseStateless<GoodsDetailsViewModel> {
  late StoreInfo storeInfo;

  @override
  Widget buildWidget(BuildContext context) {
    storeInfo = viewModel.data!.storeInfo!;
    // TODO: implement buildWidget
    return Column(
      children: [
        //TODO 价格
        Container(
          padding: EdgeInsets.all(10.h),
          child: Row(
            children: [
              Text(
                "¥",
                style: TextStyle(color: Colors.red, fontSize: 25.sp),
              ),
              Text(
                "${storeInfo.price}",
                style: TextStyle(color: Colors.red, fontSize: 45.sp),
              ),
              Text(
                "起",
                style: TextStyle(color: Colors.red, fontSize: 25.sp),
              ),
            ],
          ),
        ),
        //TODO 商品名称
        Container(
          padding: EdgeInsets.only(left: 10.h, right: 10.h),
          child: Text("${storeInfo.storeName}"),
        ),
        Container(
          padding: EdgeInsets.all(10.h),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                "原价：¥${storeInfo.otPrice}",
                style: TextStyle(fontSize: 25.sp, color: KColors.t999999),
              ),
              Text(
                "库存：${storeInfo.stock}${storeInfo.unitName}",
                style: TextStyle(fontSize: 25.sp, color: KColors.t999999),
              ),
              Text(
                "销量：${storeInfo.ficti}${storeInfo.unitName}",
                style: TextStyle(fontSize: 25.sp, color: KColors.t999999),
              ),
            ],
          ),
        ),
        //TODO 优惠券
        _buildCoupon(),
        //TODO 活动
        _buildActivity(),
        //TODO 规格
        _buildSpec(),
      ],
    );
  }

  //TODO build优惠卷
  _buildCoupon() {
    if (true) {
      return Column(
        children: [
          Divider(
            height: 1.h,
          ),
          Container(
            padding: EdgeInsets.all(10.h),
            child: Row(
              children: [
                Text("优惠券："),
              ],
            ),
          ),
        ],
      );
    }
  }

  //TODO build活动
  _buildActivity() {
    if (true) {
      return Column(
        children: [
          Divider(
            height: 1.h,
          ),
          Container(
            padding: EdgeInsets.all(10.h),
            child: Row(
              children: [
                Text("活动："),
              ],
            ),
          ),
        ],
      );
    }
  }

  //TODO build规格
  _buildSpec() {
    return Column(
      children: [
        Divider(
          thickness: 20.h,
          color: KColors.tf1f1f1,
        ),
        Container(
          padding: EdgeInsets.all(10.h),
          child: Row(
            children: [
              Text("已选择："),
            ],
          ),
        )
      ],
    );
  }
}
